3.436 \(\int \tan ^2(c+d x) (a+b \tan (c+d x))^3 \, dx\)

Optimal. Leaf size=94 \[ \frac{b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}-a x \left (a^2-3 b^2\right )-\frac{2 a b^2 \tan (c+d x)}{d}+\frac{(a+b \tan (c+d x))^4}{4 b d}-\frac{b (a+b \tan (c+d x))^2}{2 d} \]

[Out]

-(a*(a^2 - 3*b^2)*x) + (b*(3*a^2 - b^2)*Log[Cos[c + d*x]])/d - (2*a*b^2*Tan[c + d*x])/d - (b*(a + b*Tan[c + d*
x])^2)/(2*d) + (a + b*Tan[c + d*x])^4/(4*b*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0862305, antiderivative size = 94, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19, Rules used = {3543, 3482, 3525, 3475} \[ \frac{b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}-a x \left (a^2-3 b^2\right )-\frac{2 a b^2 \tan (c+d x)}{d}+\frac{(a+b \tan (c+d x))^4}{4 b d}-\frac{b (a+b \tan (c+d x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2*(a + b*Tan[c + d*x])^3,x]

[Out]

-(a*(a^2 - 3*b^2)*x) + (b*(3*a^2 - b^2)*Log[Cos[c + d*x]])/d - (2*a*b^2*Tan[c + d*x])/d - (b*(a + b*Tan[c + d*
x])^2)/(2*d) + (a + b*Tan[c + d*x])^4/(4*b*d)

Rule 3543

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
(d^2*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rule 3482

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(a + b*Tan[c + d*x])^(n - 1))/(d*(n - 1)
), x] + Int[(a^2 - b^2 + 2*a*b*Tan[c + d*x])*(a + b*Tan[c + d*x])^(n - 2), x] /; FreeQ[{a, b, c, d}, x] && NeQ
[a^2 + b^2, 0] && GtQ[n, 1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^3 \, dx &=\frac{(a+b \tan (c+d x))^4}{4 b d}-\int (a+b \tan (c+d x))^3 \, dx\\ &=-\frac{b (a+b \tan (c+d x))^2}{2 d}+\frac{(a+b \tan (c+d x))^4}{4 b d}-\int (a+b \tan (c+d x)) \left (a^2-b^2+2 a b \tan (c+d x)\right ) \, dx\\ &=-a \left (a^2-3 b^2\right ) x-\frac{2 a b^2 \tan (c+d x)}{d}-\frac{b (a+b \tan (c+d x))^2}{2 d}+\frac{(a+b \tan (c+d x))^4}{4 b d}-\left (b \left (3 a^2-b^2\right )\right ) \int \tan (c+d x) \, dx\\ &=-a \left (a^2-3 b^2\right ) x+\frac{b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}-\frac{2 a b^2 \tan (c+d x)}{d}-\frac{b (a+b \tan (c+d x))^2}{2 d}+\frac{(a+b \tan (c+d x))^4}{4 b d}\\ \end{align*}

Mathematica [C]  time = 1.05002, size = 97, normalized size = 1.03 \[ \frac{-12 a b^2 \tan (c+d x)+\frac{(a+b \tan (c+d x))^4}{b}+2 i (a+i b)^3 \log (-\tan (c+d x)+i)+2 (b+i a)^3 \log (\tan (c+d x)+i)-2 b^3 \tan ^2(c+d x)}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2*(a + b*Tan[c + d*x])^3,x]

[Out]

((2*I)*(a + I*b)^3*Log[I - Tan[c + d*x]] + 2*(I*a + b)^3*Log[I + Tan[c + d*x]] - 12*a*b^2*Tan[c + d*x] - 2*b^3
*Tan[c + d*x]^2 + (a + b*Tan[c + d*x])^4/b)/(4*d)

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 165, normalized size = 1.8 \begin{align*}{\frac{{b}^{3} \left ( \tan \left ( dx+c \right ) \right ) ^{4}}{4\,d}}+{\frac{a{b}^{2} \left ( \tan \left ( dx+c \right ) \right ) ^{3}}{d}}+{\frac{3\,b{a}^{2} \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}-{\frac{{b}^{3} \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}+{\frac{{a}^{3}\tan \left ( dx+c \right ) }{d}}-3\,{\frac{a{b}^{2}\tan \left ( dx+c \right ) }{d}}-{\frac{3\,\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) b{a}^{2}}{2\,d}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ){b}^{3}}{2\,d}}-{\frac{{a}^{3}\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}+3\,{\frac{\arctan \left ( \tan \left ( dx+c \right ) \right ) a{b}^{2}}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2*(a+b*tan(d*x+c))^3,x)

[Out]

1/4/d*b^3*tan(d*x+c)^4+1/d*a*b^2*tan(d*x+c)^3+3/2/d*b*a^2*tan(d*x+c)^2-1/2/d*b^3*tan(d*x+c)^2+a^3*tan(d*x+c)/d
-3*a*b^2*tan(d*x+c)/d-3/2/d*ln(1+tan(d*x+c)^2)*b*a^2+1/2/d*ln(1+tan(d*x+c)^2)*b^3-1/d*a^3*arctan(tan(d*x+c))+3
/d*arctan(tan(d*x+c))*a*b^2

________________________________________________________________________________________

Maxima [A]  time = 1.70277, size = 154, normalized size = 1.64 \begin{align*} \frac{b^{3} \tan \left (d x + c\right )^{4} + 4 \, a b^{2} \tan \left (d x + c\right )^{3} + 2 \,{\left (3 \, a^{2} b - b^{3}\right )} \tan \left (d x + c\right )^{2} - 4 \,{\left (a^{3} - 3 \, a b^{2}\right )}{\left (d x + c\right )} - 2 \,{\left (3 \, a^{2} b - b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 4 \,{\left (a^{3} - 3 \, a b^{2}\right )} \tan \left (d x + c\right )}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^3,x, algorithm="maxima")

[Out]

1/4*(b^3*tan(d*x + c)^4 + 4*a*b^2*tan(d*x + c)^3 + 2*(3*a^2*b - b^3)*tan(d*x + c)^2 - 4*(a^3 - 3*a*b^2)*(d*x +
 c) - 2*(3*a^2*b - b^3)*log(tan(d*x + c)^2 + 1) + 4*(a^3 - 3*a*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.77543, size = 261, normalized size = 2.78 \begin{align*} \frac{b^{3} \tan \left (d x + c\right )^{4} + 4 \, a b^{2} \tan \left (d x + c\right )^{3} - 4 \,{\left (a^{3} - 3 \, a b^{2}\right )} d x + 2 \,{\left (3 \, a^{2} b - b^{3}\right )} \tan \left (d x + c\right )^{2} + 2 \,{\left (3 \, a^{2} b - b^{3}\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 4 \,{\left (a^{3} - 3 \, a b^{2}\right )} \tan \left (d x + c\right )}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^3,x, algorithm="fricas")

[Out]

1/4*(b^3*tan(d*x + c)^4 + 4*a*b^2*tan(d*x + c)^3 - 4*(a^3 - 3*a*b^2)*d*x + 2*(3*a^2*b - b^3)*tan(d*x + c)^2 +
2*(3*a^2*b - b^3)*log(1/(tan(d*x + c)^2 + 1)) + 4*(a^3 - 3*a*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Sympy [A]  time = 0.679482, size = 160, normalized size = 1.7 \begin{align*} \begin{cases} - a^{3} x + \frac{a^{3} \tan{\left (c + d x \right )}}{d} - \frac{3 a^{2} b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{3 a^{2} b \tan ^{2}{\left (c + d x \right )}}{2 d} + 3 a b^{2} x + \frac{a b^{2} \tan ^{3}{\left (c + d x \right )}}{d} - \frac{3 a b^{2} \tan{\left (c + d x \right )}}{d} + \frac{b^{3} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{b^{3} \tan ^{4}{\left (c + d x \right )}}{4 d} - \frac{b^{3} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right )^{3} \tan ^{2}{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2*(a+b*tan(d*x+c))**3,x)

[Out]

Piecewise((-a**3*x + a**3*tan(c + d*x)/d - 3*a**2*b*log(tan(c + d*x)**2 + 1)/(2*d) + 3*a**2*b*tan(c + d*x)**2/
(2*d) + 3*a*b**2*x + a*b**2*tan(c + d*x)**3/d - 3*a*b**2*tan(c + d*x)/d + b**3*log(tan(c + d*x)**2 + 1)/(2*d)
+ b**3*tan(c + d*x)**4/(4*d) - b**3*tan(c + d*x)**2/(2*d), Ne(d, 0)), (x*(a + b*tan(c))**3*tan(c)**2, True))

________________________________________________________________________________________

Giac [B]  time = 4.50603, size = 2005, normalized size = 21.33 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))^3,x, algorithm="giac")

[Out]

-1/4*(4*a^3*d*x*tan(d*x)^4*tan(c)^4 - 12*a*b^2*d*x*tan(d*x)^4*tan(c)^4 - 6*a^2*b*log(4*(tan(c)^2 + 1)/(tan(d*x
)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan
(c)^4 + 2*b^3*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)
^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan(c)^4 - 16*a^3*d*x*tan(d*x)^3*tan(c)^3 + 48*a*b^2*d*x*tan(d*x)^3*ta
n(c)^3 - 6*a^2*b*tan(d*x)^4*tan(c)^4 + 3*b^3*tan(d*x)^4*tan(c)^4 + 24*a^2*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*t
an(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^3*tan(c)^3
 - 8*b^3*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 -
2*tan(d*x)*tan(c) + 1))*tan(d*x)^3*tan(c)^3 + 4*a^3*tan(d*x)^4*tan(c)^3 - 12*a*b^2*tan(d*x)^4*tan(c)^3 + 4*a^3
*tan(d*x)^3*tan(c)^4 - 12*a*b^2*tan(d*x)^3*tan(c)^4 + 24*a^3*d*x*tan(d*x)^2*tan(c)^2 - 72*a*b^2*d*x*tan(d*x)^2
*tan(c)^2 - 6*a^2*b*tan(d*x)^4*tan(c)^2 + 2*b^3*tan(d*x)^4*tan(c)^2 + 12*a^2*b*tan(d*x)^3*tan(c)^3 - 8*b^3*tan
(d*x)^3*tan(c)^3 - 6*a^2*b*tan(d*x)^2*tan(c)^4 + 2*b^3*tan(d*x)^2*tan(c)^4 + 4*a*b^2*tan(d*x)^4*tan(c) - 36*a^
2*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan
(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 + 12*b^3*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c
) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 - 12*a^3*tan(d*x)^3*tan(c)^
2 + 48*a*b^2*tan(d*x)^3*tan(c)^2 - 12*a^3*tan(d*x)^2*tan(c)^3 + 48*a*b^2*tan(d*x)^2*tan(c)^3 + 4*a*b^2*tan(d*x
)*tan(c)^4 - b^3*tan(d*x)^4 - 16*a^3*d*x*tan(d*x)*tan(c) + 48*a*b^2*d*x*tan(d*x)*tan(c) + 12*a^2*b*tan(d*x)^3*
tan(c) - 8*b^3*tan(d*x)^3*tan(c) - 12*a^2*b*tan(d*x)^2*tan(c)^2 + 4*b^3*tan(d*x)^2*tan(c)^2 + 12*a^2*b*tan(d*x
)*tan(c)^3 - 8*b^3*tan(d*x)*tan(c)^3 - b^3*tan(c)^4 - 4*a*b^2*tan(d*x)^3 + 24*a^2*b*log(4*(tan(c)^2 + 1)/(tan(
d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*ta
n(c) - 8*b^3*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^
2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) + 12*a^3*tan(d*x)^2*tan(c) - 48*a*b^2*tan(d*x)^2*tan(c) + 12*a^3*t
an(d*x)*tan(c)^2 - 48*a*b^2*tan(d*x)*tan(c)^2 - 4*a*b^2*tan(c)^3 + 4*a^3*d*x - 12*a*b^2*d*x - 6*a^2*b*tan(d*x)
^2 + 2*b^3*tan(d*x)^2 + 12*a^2*b*tan(d*x)*tan(c) - 8*b^3*tan(d*x)*tan(c) - 6*a^2*b*tan(c)^2 + 2*b^3*tan(c)^2 -
 6*a^2*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 -
2*tan(d*x)*tan(c) + 1)) + 2*b^3*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*t
an(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) - 4*a^3*tan(d*x) + 12*a*b^2*tan(d*x) - 4*a^3*tan(c) + 12*a*b^2*
tan(c) - 6*a^2*b + 3*b^3)/(d*tan(d*x)^4*tan(c)^4 - 4*d*tan(d*x)^3*tan(c)^3 + 6*d*tan(d*x)^2*tan(c)^2 - 4*d*tan
(d*x)*tan(c) + d)